﻿using Mall.Repository.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Mall.Repository.RepositoryProgram
{
    internal class NewArrayExpressionToSql : BaseExpressionToSql<NewArrayExpression>
    {
        protected override SqlBuilder In(NewArrayExpression expression, SqlBuilder sqlBuilder)
        {
            sqlBuilder += "(";
            foreach (Expression expression2 in expression.Expressions)
            {
                ExpressionToSqlProvider.In(expression2, sqlBuilder);
            }

            if (sqlBuilder[sqlBuilder.Length - 1] == ',')
            {
                sqlBuilder.Remove(sqlBuilder.Length - 1, 1);
            }

            sqlBuilder += ")";
            return sqlBuilder;
        }
    }
}
